<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员登陆</title>
<base href="<?php echo base_url();?>public/default/"/>
<link href="css/login.css" rel="stylesheet" type="text/css">
</head>

<body class="login">

<div class="login_m">
    <div class="login_logo"><a href="<?php  echo site_url('index');?>"><img src="images/logo.png" width="196" height="46"/></a></div>
    <div class="login_boder">
        <div class="login_padding">
            <h2>用户名</h2>
            <label>
                <input type="text" id="username" name="username" class="txt_input txt_input2" onfocus="if (value =='Your name'){value =''}" onblur="if (value ==''){value='Your name'}" value="Your name">
            </label>
            <h2>密码</h2>
            <label>
                <input type="password" id="password" name="password" class="txt_input" onfocus="if (value =='******'){value =''}" onblur="if (value ==''){value='******'}" value="******">
            </label>
            <p class="forgot"><a href="javascript:void(0);">忘记密码?</a></p>
            <div class="rem_sub">
                <div class="rem_sub_l">
                    <input type="checkbox" name="checkbox" checked="checked" id="remember">
                    <label for="remember">记住</label>
                </div>
                <label>
                    <input type="submit" class="sub_button" name="button" id="btn_login" value="登录" style="opacity: 0.7;">
                </label>
            </div>
        </div>
    </div><!--login_boder end-->
</div><!--login_m end-->
<script src="../plugins/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    //登陆
    function login(){
        var url = '<?php echo site_url('ajax/member_handle/login');?>';
        var data = {};
        data.username = $('#username').val();
        data.password = $('#password').val();
        data.remember = $('#remember').prop("checked") ? 1 : 0;
        if(!data.username||data.username=='Your name'){ alert('请输入用户名'); return; }
        if(!data.password||data.password=='******'){ alert('请输入密码'); return; }
        $.post(url, data, function(rs){
            if(rs.err===0){
                location.href = '<?php echo site_url('member/index');?>';            
            }else{
                alert(rs.msg);
                $('#password').val('');
            }
        },'json');
    }
    $(document).ready(function () {
        //注册登陆事件        
        $("#btn_login").click(function(){
            login();
            return false;
        });
        $("#password").keydown(function(event){
            if(event.which == "13") {   
                login();
            }
        });    
    });
</script>
</body>
</html>